package com.cys.markdown.doc.admin.controller;

import com.cys.common.data.RespCodeEnum;
import com.cys.common.pojo.RespEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Demo Controller
 * Created by cyy on 2018/6/8.
 */
@Controller
@RequestMapping("/admin/demo")
public class DemoController {

    private Logger LOGGER = LoggerFactory.getLogger(DemoController.class);

    /**
     * 去模板引擎Demo页面
     *
     * @author caiyushen
     */
    @RequestMapping(value = "/toTemplate", method = RequestMethod.GET)
    public String toTemplate() throws Exception {
        LOGGER.info("method[toTemplate] start");
        return "upload_demo";
    }

    /**
     * 去日志查看页面
     */
    @RequestMapping(value = "/toLog", method = RequestMethod.GET)
    public String toLog() throws Exception {
        LOGGER.info("method[toLog] start");
        return "log/info";
    }

    /**
     * 测试日志
     */
    @RequestMapping(value = "/testLog", method = RequestMethod.GET)
    @ResponseBody
    public RespEntity testLog() {
        LOGGER.info("method[testLog] info");
        LOGGER.warn("method[testLog] warn");
        LOGGER.error("method[testLog] error");
        return new RespEntity(RespCodeEnum.success);
    }


}
